home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / magazi~1 / 403 / animinpt.lst < prev    next >
Encoding:
File List  |  1989-04-11  |  2.8 KB  |  128 lines

  1. ' *******************************************
  2. ' *                                         *
  3. ' *         Animated Input GFA              *
  4. ' *          by A. Baggetta                 *
  5. ' *                                         *
  6. ' *       Copyright 1989 by ST-LOG          *
  7. ' *******************************************
  8. '
  9. '
  10. ' Set screen colors
  11. '
  12. Setcolor 0,3,4,5
  13. Setcolor 15,7,7,7
  14. '
  15. ' Set the starting points for animated box
  16. '
  17. Cd_right%=5
  18. Rd_down%=5
  19. C%=10
  20. R%=10
  21. '
  22. ' Draw box of asterisks
  23. '
  24. Print At(Cd_right%,Rd_down%);"****************************"
  25. For Ln_row%=6 To 15
  26.   Print At(Cd_right%,Ln_row%);"*                          *"
  27. Next Ln_row%
  28. Print At(Cd_right%,15);"***************************"
  29. Print At(11,7);"Enter Your Name:"
  30. '
  31. ' Begin the main loop for animation and input
  32. '
  33. Repeat
  34.   X$=Inkey$
  35.   '
  36.   ' Move the asterisk to the right on screen
  37.   '
  38.   If X$="" And Rd_down%=5 And Cd_right%<32 Then
  39.     Inc Cd_right%
  40.     Print At(Cd_right%,Rd_down%);"*";
  41.     @Del_ay
  42.     Print At(Cd_right%,Rd_down%);" "
  43.     @Del_ay
  44.     Print At(Cd_right%,Rd_down%);"*"
  45.     @Del_ay
  46.   Endif
  47.   '
  48.   ' Move the asterisk down on screen
  49.   '
  50.   If X$="" And Cd_right%=32 And Rd_down%<15 Then
  51.     Inc Rd_down%
  52.     Print At(Cd_right%,Rd_down%);"*";
  53.     @Del_ay
  54.     Print At(Cd_right%,Rd_down%);" "
  55.     @Del_ay
  56.     Print At(Cd_right%,Rd_down%);"*"
  57.     @Del_ay
  58.   Endif
  59.   '
  60.   ' Move the asterisk to the left on screen
  61.   '
  62.   If X$="" And Rd_down%=15 And Cd_right%>5 Then
  63.     Dec Cd_right%
  64.     Print At(Cd_right%,Rd_down%);"*";
  65.     @Del_ay
  66.     Print At(Cd_right%,Rd_down%);" "
  67.     @Del_ay
  68.     Print At(Cd_right%,Rd_down%);"*"
  69.     @Del_ay
  70.   Endif
  71.   '
  72.   ' Move the asterisk up on screen
  73.   '
  74.   If X$="" And Cd_right%=5 And Rd_down%>5 Then
  75.     Dec Rd_down%
  76.     Print At(Cd_right%,Rd_down%);"*";
  77.     @Del_ay
  78.     Print At(Cd_right%,Rd_down%);" "
  79.     @Del_ay
  80.     Print At(Cd_right%,Rd_down%);"*"
  81.     @Del_ay
  82.   Endif
  83.   '
  84.   ' INPUT EXAMINATION
  85.   '
  86.   '
  87.   ' If a legal key is pressed, print it.
  88.   '
  89.   If X$<>"" And X$<>Chr$(8) Then
  90.     C%=C%+1
  91.     Print At(C%,R%);X$
  92.     Name$=Name$+X$
  93.   Endif
  94.   '
  95.   ' If the <backspace> key is pressed, erase the string so far
  96.   '
  97.   If X$=Chr$(8) Then
  98.     For Ers=10 To C%
  99.       Print At(Ers,R%);" "
  100.     Next Ers
  101.     C%=10
  102.     Name$=""
  103.   Endif
  104.   '
  105.   ' If the <return> or the max length of string, jump out of loop
  106.   '
  107. Until X$=Chr$(13) Or C%=25   ! Max happens to be 15 characters here.
  108. '
  109. ' Print the string -- here it is called Name$.
  110. '
  111. Print At(11,18);Name$
  112. Print At(13,20);"Press A Key"
  113. '
  114. ' Hold on screen for this demo until a key is pressed
  115. '
  116. Repeat
  117. Until Inkey$<>""
  118. Setcolor 0,7,7,7
  119. Setcolor 15,0,0,0
  120. '
  121. ' A delay loop to keep the asterisks from moving too fast.
  122. ' Make this a smaller number and watch the speed.
  123. '
  124. Procedure Del_ay
  125.   For D%=1 To 100
  126.   Next D%
  127. Return
  128.